<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<!-- 
Look at this page http://red-orange.cn/wiki/index.php/Messages_and_Constants for more information.
 -->
<xsl:param name="language" />
<xsl:param name="defaultLanguage" select="en" />

<xsl:template match="/">

<xsl:for-each select="//businessRules/businessRule[child::message[@language=$language]]">
<xsl:variable name="object"><xsl:value-of select="../../@name"/></xsl:variable>
<xsl:variable name="attribute"><xsl:value-of select="@attributes"/></xsl:variable>
<xsl:variable name="number"><xsl:value-of select="@number"/></xsl:variable>
<xsl:for-each select="message[@language=$language]">
<xsl:value-of select="$object"/>.businessRule_<xsl:value-of select="$number"/>=<xsl:value-of select="normalize-space(text())"/>
<xsl:text>&#xa;</xsl:text> 
</xsl:for-each>
</xsl:for-each>

<xsl:for-each select="//messages/messageBundle[child::message[@language=$language]]">
<xsl:variable name="object"><xsl:value-of select="../../@name"/></xsl:variable>
<xsl:variable name="number"><xsl:value-of select="@number"/></xsl:variable>
<xsl:for-each select="message[@language=$language]">
<xsl:value-of select="$object"/>.message_<xsl:value-of select="$number"/>=<xsl:value-of select="normalize-space(text())"/>
<xsl:text>&#xa;</xsl:text> 
</xsl:for-each>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>